<include file="Public:head" title='邮箱配置' />
<script>
    function joinShorts(url) {
        if (url == '') {
            url = "{:U('Box/joinShorts')}";
        }
        $.post(url, {
        }, function(data) {
            $('#mainbox2').html(data);
            showbgbox3('#mainbox2', 0, 0);
            $(".page a").click(function() {
                var href = $(this).attr("data-href");
                choseShop(href);
            })
        })
    }
    function sendEmail() {
        var email = $("input[name=test_email]").val();
        var title = $("input[name=test_title]").val();
        var content = $("input[name=test_content]").val();
        if (email == '') {
            showTip('系统提示', '测试邮箱不能为空！', '2');
            return false;
        }
        var pattern_email = /^[ _a-z0-9]+@([ _a-z0-9])+(\.+[a-z0-9]{2,3}){1,2}$/;
        if (pattern_email.test(email) == false) {
            showTip('系统提示', '测试邮箱格式有误！', '2');
            return false;
        }
        if (title == '') {
            showTip('系统提示', '标题不能为空！', '2');
            return false;
        }
        if (content == '') {
            showTip('系统提示', '内容不能为空！', '2');
            return false;
        }
        $("#sending").html("正在发送...").removeClass('green');
        $.post("{:U('Ajax/sendEmail')}", {email: email, title: title, content: content},
        function(data) {
            $("#sending").html("发送成功！").addClass('green');
        })
    }
</script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('Communications/email')}">邮箱管理</a></li>
                    <li class="active">邮箱配置</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">邮箱配置</h3>

                                <form action="{:U('Communications/email_set_post')}" method="POST" id="form">
                                    <table class="table table_detail">
                                        <tbody>

                                            <tr class="pay_title pay_select" >
                                                <td colspan='2' style='padding-left: 12px;font-size: 14px'><strong>基本设置</strong></td>
                                            </tr>
                                            <tr class="a1">
                                                <td class="td_left">开启状态</td>
                                                <td>
                                                    <label><input name="is_start" type="radio" value="1" <if condition="$detail.is_start eq 1">checked</if> 
                                                        autocomplete='off'/> 开启</label>
                                                    <label><input   name="is_start" type="radio"   value="0" <if condition="$detail.is_start eq 0">checked</if> 
                                                        autocomplete='off'/> 关闭</label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">地址</td>
                                                <td>
                                                    <input type="text" name="smpt" id="smpt" autocomplete="off" class="common_txt" value='{$detail.smpt}'>
                                                    <span class='orange'>一般选择smtp方式，个别linux可选择mail方式。</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">用户名</td>
                                                <td>
                                                    <input type="text" name="account" id="account" autocomplete="off" class="common_txt" value='{$detail.account}'>
                                                    <span class='orange'>如：smtp.126.com。建议使用126邮箱，QQ邮箱需要自行在QQ邮箱设置</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">密码</td>
                                                <td>
                                                    <input type="password" name="pwd" autocomplete="off"class="common_txt" value='{$detail.pwd}'>
                                                    <span class='orange'>您的邮箱用户名，如service@tiantian.com。</span>
                                                </td>
                                            </tr>
                                            <tr class="pay_title pay_select" >
                                                <td colspan='2' style='padding-left: 12px;font-size: 14px'><strong>下单成功</strong></td>
                                            </tr>
                                            <tr class="a1" >
                                                <td class="td_left">接受邮箱号码</td>
                                                <td>
                                                    <input type="text"  id="emails" style="width:250px"  value="{$detail.emails}" name="emails" autocomplete="off"/>
                                                    <p class="red">用户下完单，该邮箱号都可以收到邮箱。（多个邮箱号码以英文逗号,隔开;默认接受号码为商家邮箱号码）</p>
                                                </td>
                                            </tr>


                                            <tr id="my_downOrder" class="a1">
                                                <td class="td_left">下单成功内容</td>
                                                <td>
                                                    <textarea  class="a1" rows="4"   name="send_suc"  style="overflow:hidden; width:70%;font-size: 13px;padding:5px;">{$detail.send_suc}</textarea>
                                                    <p style="color:#FF0000; font-weight:bold"></p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">测试邮箱:</td>
                                                <td>
                                                    <input type="text" name="test_email" value='416148489@qq.com' autocomplete="off"class="common_txt" >
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">测试标题:</td>
                                                <td>
                                                    <input type="text" name="test_title" autocomplete="off"class="common_txt" value='测试标题' >
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">测试内容:</td>
                                                <td>
                                                    <input type="text" name="test_content" autocomplete="off"class="common_txt" value='测试内容' >
                                                    <input class="searchbutton" type="button" value="发送内容" onclick='sendEmail()'>
                                                    <span id='sending'></span>
                                                </td>
                                            </tr>

                                            <tr class="pay_title pay_select" >
                                                <td colspan='2' style='padding-left: 12px;font-size: 14px'><strong>备注</strong></td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">标签对应</td>
                                                <td style="text-align:left;" colspan="4">
                                                    用户姓名：{truename}<br>
                                                    用户手机：{phone}<br>
                                                    用户电话：{phone2}<br>
                                                    用户地址：{addr}<br>
                                                    商 家 名：{shopname}<br>
                                                    下单时间：{addtime}<br>
                                                    下单内容：{content}<br>
                                                    下单备注：{remark}<br>
                                                    订 单 号：{ordernum}<br>
                                                    订单金额：{realMoney}<br>

                                                    <p style="color:#FF0000">邮箱示例：尊敬的{shopname}：用户{truename}在{addtime}购买了{content},{remark},手机：{phone},地址：{addr}。
                                                        <br>邮箱内容：尊敬的炫迈酒店：用户黄金林在10:30购买了鸡翅一份、汉堡两份,11:30送出,手机：18252088547,地址：南理工1147。</p>

                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <button class="btn btn-info btn-sm" type="submit">
                                                        <i class="icon-ok bigger-110 "></i>
                                                        保 存
                                                    </button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>
<include file="Public:foot" />